using dnAnalytics.Math;
using NUnit.Framework;

namespace dnAnalytics.Tests.Math
{
    [TestFixture]
    public class ComplexMath_ArgumentTest32
    {
        [Test]
        public void Argument()
        {
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, 1.19209289550780998537e-7F)), 1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, -1.19209289550780998537e-7F)), -1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, 5.0e-1F)), 1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, -5.0e-1F)), -1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, 1.0F)), 1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, -1.0F)), -1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, 2.0F)), 1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, -2.0F)), -1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, 8.388608e6F)), 1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(0.0F, -8.388608e6F)), -1.57079632679489661923, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 0.0F)), 0.0F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 0.0F)), 3.14159265358979323846, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 1.19209289550780998537e-7F)), 7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, -1.19209289550780998537e-7F)), -7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 1.19209289550780998537e-7F)), 2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, -1.19209289550780998537e-7F)), -2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 5.0e-1F)), 1.57079608837631751767, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, -5.0e-1F)), -1.57079608837631751767, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 5.0e-1F)), 1.57079656521347572079, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, -5.0e-1F)), -1.57079656521347572079, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 1.0F)), 1.57079620758560706845, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, -1.0F)), -1.57079620758560706845, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 1.0F)), 1.57079644600418617001, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, -1.0F)), -1.57079644600418617001, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 2.0F)), 1.57079626719025184384, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, -2.0F)), -1.57079626719025184384, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 2.0F)), 1.57079638639954139462, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, -2.0F)), -1.57079638639954139462, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, 8.388608e6F)), 1.57079632679488240838, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.19209289550780998537e-7F, -8.388608e6F)), -1.57079632679488240838, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, 8.388608e6F)), 1.57079632679491083009, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.19209289550780998537e-7F, -8.388608e6F)), -1.57079632679491083009, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 0.0F)), 0.0F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 0.0F)), 3.14159265358979323846, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 1.19209289550780998537e-7F)), 2.38418579101557479565e-7F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, -1.19209289550780998537e-7F)), -2.38418579101557479565e-7F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 1.19209289550780998537e-7F)), 3.14159241517121413691, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, -1.19209289550780998537e-7F)), -3.14159241517121413691, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 5.0e-1F)), 7.85398163397448309616e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, -5.0e-1F)), -7.85398163397448309616e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 5.0e-1F)), 2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, -5.0e-1F)), -2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 1.0F)), 1.10714871779409050302, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, -1.0F)), -1.10714871779409050302, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 1.0F)), 2.03444393579570273545, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, -1.0F)), -2.03444393579570273545, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 2.0F)), 1.32581766366803246506, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, -2.0F)), -1.32581766366803246506, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 2.0F)), 1.8157749899217607734, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, -2.0F)), -1.8157749899217607734, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, 8.388608e6F)), 1.57079626719025184384, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(5.0e-1F, -8.388608e6F)), -1.57079626719025184384, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, 8.388608e6F)), 1.57079638639954139462, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-5.0e-1F, -8.388608e6F)), -1.57079638639954139462, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 0.0F)), 0.0F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 0.0F)), 3.14159265358979323846, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 1.19209289550780998537e-7F)), 1.19209289550780433848e-7F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, -1.19209289550780998537e-7F)), -1.19209289550780433848e-7F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 1.19209289550780998537e-7F)), 3.14159253438050368768, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, -1.19209289550780998537e-7F)), -3.14159253438050368768, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 5.0e-1F)), 4.63647609000806116214e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, -5.0e-1F)), -4.63647609000806116214e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 5.0e-1F)), 2.67794504458898712225, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, -5.0e-1F)), -2.67794504458898712225, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 1.0F)), 7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, -1.0F)), -7.85398163397448309616e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 1.0F)), 2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, -1.0F)), -2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 2.0F)), 1.10714871779409050302, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, -2.0F)), -1.10714871779409050302, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 2.0F)), 2.03444393579570273545, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, -2.0F)), -2.03444393579570273545, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, 8.388608e6F)), 1.57079620758560706845, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(1.0F, -8.388608e6F)), -1.57079620758560706845, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, 8.388608e6F)), 1.57079644600418617001, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-1.0F, -8.388608e6F)), -1.57079644600418617001, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 0.0F)), 0.0F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 0.0F)), 3.14159265358979323846, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 1.19209289550780998537e-7F)), 5.96046447753904286825e-8, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, -1.19209289550780998537e-7F)), -5.96046447753904286825e-8, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 1.19209289550780998537e-7F)), 3.14159259398514846307, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, -1.19209289550780998537e-7F)), -3.14159259398514846307, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 5.0e-1F)), 2.44978663126864154172e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, -5.0e-1F)), -2.44978663126864154172e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 5.0e-1F)), 2.89661399046292908429, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, -5.0e-1F)), -2.89661399046292908429, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 1.0F)), 4.63647609000806116214e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, -1.0F)), -4.63647609000806116214e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 1.0F)), 2.67794504458898712225, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, -1.0F)), -2.67794504458898712225, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 2.0F)), 7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, -2.0F)), -7.85398163397448309616e-1, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 2.0F)), 2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, -2.0F)), -2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, 8.388608e6F)), 1.57079608837631751767, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(2.0F, -8.388608e6F)), -1.57079608837631751767, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, 8.388608e6F)), 1.57079656521347572079, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-2.0F, -8.388608e6F)), -1.57079656521347572079, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 0.0F)), 0.0F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 0.0F)), 3.14159265358979323846, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 1.19209289550780998537e-7F)), 1.42108547152019737407e-14, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, -1.19209289550780998537e-7F)), -1.42108547152019737407e-14, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 1.19209289550780998537e-7F)), 3.14159265358977902761, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, -1.19209289550780998537e-7F)), -3.14159265358977902761, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 5.0e-1F)), 5.96046447753905544139e-8, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, -5.0e-1F)), -5.96046447753905544139e-8, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 5.0e-1F)), 3.14159259398514846307, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, -5.0e-1F)), -3.14159259398514846307, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 1.0F)), 1.19209289550780685311e-7, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, -1.0F)), -1.19209289550780685311e-7, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 1.0F)), 3.14159253438050368768, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, -1.0F)), -3.14159253438050368768, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 2.0F)), 2.38418579101557982491e-7, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, -2.0F)), -2.38418579101557982491e-7, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 2.0F)), 3.1415924151712141369, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, -2.0F)), -3.1415924151712141369, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, 8.388608e6F)), 7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(8.388608e6F, -8.388608e6F)), -7.85398163397448309616e-1F, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, 8.388608e6F)), 2.35619449019234492885, 1e-7);
            TestHelper.TestRelativeError(ComplexMath.Argument(new Complex32(-8.388608e6F, -8.388608e6F)), -2.35619449019234492885, 1e-7);
        }
    }
}